package com.qipay.utils;

import org.springframework.stereotype.Component;

/**
 * Creator: Yao
 * Date:    2017/6/12
 * For:
 * Other:
 */
@Component
public class MathUtils {

    public static double round2(double val) {
        return Math.round(val * 100) / 100.0;
    }

    public static void main(String[] args) {
        double val = 1.2300001d;
        System.out.println(MathUtils.round2(val));
        val = 1234.4321d;
        System.out.println(MathUtils.round2(val));
        val = 1234.1d;
        System.out.println(MathUtils.round2(val));
        val = 1.105d;
        System.out.println(MathUtils.round2(val));
    }
}
